package com.lsu.app.mapper;

import com.lsu.app.bean.Collect;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Set;

/**
 *
 * @description 针对表【collect(收藏/关注)】的数据库操作Mapper
 * @Date 2023-10-18 20:22:23
 * @author hjj
 */
@Mapper
public interface CollectMapper extends BaseMapper<Collect> {
    @Select("select COUNT(*) from collect where user_id=#{userId} and link_id=#{linkId} and type=#{type}")
    Integer collectCount(@Param("userId") Integer userId,@Param("linkId") Integer linkId,@Param("type")Integer type);
    @Select("select COUNT(*) from collect where link_id=#{teacherId} and type=1")
    Integer CountByTeacherId(Integer teacherId);//获取关注教师的学生数目
    @Select("select kv_value_id from kind where course_id in(select link_id from collect where type=2 and user_id=#{userId})")
    Set<Integer> CourseKindIdsByUserId(Integer userId);//获取到收藏的课程的类别id

}




